package C11_10_FormTemplateMethod.refactorafter;

/**
 * @ClassName : ResidentialSite
 * @Description : 塑造模板函数
 * @Author : wukj1
 * @Date: 2022/8/16
 **/
public class ResidentialSite extends Site {

    public ResidentialSite(double units, double rate) {
        super(units, rate);
    }

    @Override
    public double getBillableAmount() {
        double base = units * rate * 0.5;
        double tax = base * Site.TAX_RATE * 0.2;
        return base + tax;
    }

    @Override
    protected double getBaseAmount() {
        return units * rate * 0.5;
    }

    @Override
    protected double getTaxAmount() {
        return getBaseAmount() * Site.TAX_RATE * 0.2;
    }
}
